package com.spring.boot.fusion.ehcache.controller;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class Test {
	
	private static List<String> userName=new ArrayList<>();
	
	@GetMapping("test1")
	@Cacheable(cacheNames = "test")
	public Object test1() {
		//判断是否执行缓存的语句
		System.out.println("tes1111111111111111111111111111111");
		return userName;
	}
	
	@GetMapping("test2")
	@CacheEvict(cacheNames="test",allEntries=true)
	public Object test2() {
		userName.add(UUID.randomUUID().toString());
		return userName;
	}

}
